import request from '@/config/axios'

export interface MRegisterVO{
  id: number
  doctorName: string
  doctorId: number
  patientsName: string
  patientsId: number
  deptName: string
  deptId: number
  date: string
  period: number
  consultingTime: string
  cost: number
  mobile: string
  describe: string
  status: number
  createTime: Date
}

// 查询挂号管理列表
export const getRegisterPage = (params: PageParam) => {
  return request.get({ url: '/medical/register/page', params })
}

// 查询挂号详情
export const getRegister = (id: number) => {
  return request.get({ url: '/medical/register/get?id=' + id })
}

// 新增挂号
export const createRegister = (data: MRegisterVO) => {
  return request.post({ url: '/medical/register/create', data })
}

// 修改挂号
export const updateRegister = (data: MRegisterVO) => {
  return request.put({ url: '/medical/register/update', data })
}

// 删除挂号
export const deleteRegister = (id: number) => {
  return request.delete({ url: '/medical/register/delete?id=' + id })
}


// 挂号状态修改
export const updateRegisterStatus = (id: number, status: number) => {
  const data = {
    id,
    status
  }
  return request.put({ url: '/medical/register/update-status', data: data })
}

// 获取用户最近的挂号记录
export const getUserRecentRegisterList = (patientId: number, date: string) => {
  return request.get({ url: '/medical/register/user-recent-list?patientId=' + patientId 
    + '&date=' + date })
}

// 获取用户挂号记录
export const getUserRegisterList = (patientId: number) => {
  return request.get({ url: '/medical/register/user-list?patientId=' + patientId })
}


// 取消挂号
export const cancelRegister = (id: number) => {
  return request.put({ url: '/medical/register/cancel?id=' + id })
}
